#include <iostream>

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int j,P,weight,w;
    k = n/k + (n%k ==0 ? 0:1);
    for(j =k,weight = 0,P=0;n > 0;n--){
        cin >> w;
        weight += w;
        if(--j == 0){
            if(weight > P){
                P = weight;
            }
            weight = 0;
            j = k;
            continue;
        }
        
    }
    cout << P << endl;
}